package chapter4.parallel;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import util.Conn;

/**
 * Created by uu on 2017/6/19.
 */
public class image_producer {
    public static void main(String[] args) throws Exception{
        Connection conn = new Conn().getConnection();
        Channel channel= conn.createChannel();
        channel.exchangeDeclare("upload-pictures","fanout",true);
        AMQP.BasicProperties properties = new AMQP.BasicProperties.Builder().contentType("text/plain").deliveryMode(2).build();
        byte[] messageBodyBytes = ("{'name':'lp','height':'173'}").getBytes();
        for(int i=0;i<10;i++) {
        channel.basicPublish("upload-pictures", "", properties, messageBodyBytes);
        }
        System.out.println("start publish!");
        channel.close();
        conn.close();
    }
}
